package cn.xanderye.ribbon.consumer.controller;

import cn.xanderye.ribbon.consumer.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;


/**
 * Created on 2019/12/25.
 *
 * @author 叶振东
 */
@RestController
public class ConsumerController {

    @Autowired
    private HelloService helloService;

    @GetMapping("ribbon-consumer")
    public String helloConsumer() {
        return helloService.helloService();
    }

    @GetMapping("ribbon-consumer2")
    public String helloConsumer2() throws ExecutionException, InterruptedException {
        return helloService.helloServiceSync().get();
    }
}
